import { defineStore } from 'pinia';

import {
  AdministrationListApi,
  RegisterApi,
  DeleteUsersApi,
  dashboardApi,
  AccoutUpdateApi,
  filemanageGroupAddApi,
  filemanageGroupListApi,
  filemanageGroupDelApi,
  getImageApi,
  ImageDelApi,
} from '/@/api/locality/admin';
import { store } from '/@/store';

interface adminData {
  userInfo: any;
}

export const adminStore: any = defineStore({
  id: 'app-admin',
  state: (): adminData => ({
    userInfo: null,
  }),
  getters: {},
  actions: {
    async GetAdminList(params) {
      const data = AdministrationListApi(params);
      return data;
    },
    async AccoutRegister(params) {
      const data = RegisterApi(params);

      return data;
    },
    async AccoutUpdate(params) {
      const data = AccoutUpdateApi(params);

      return data;
    },
    async AccountDelete(params) {
      const data = DeleteUsersApi(params);
      return data;
    },
    async Getdashboard(params) {
      const data = dashboardApi(params);
      return data;
    },
    async filemanage_group_add(params) {
      const data = filemanageGroupAddApi(params);
      return data;
    },
    async filemanage_group_list(params) {
      const data = filemanageGroupListApi(params);
      return data;
    },
    async filemanage_group_delete(params) {
      const data = filemanageGroupDelApi(params);
      return data;
    },
    async getImage(params) {
      const data = getImageApi(params);
      return data;
    },
    async ImageDel(params) {
      const data = ImageDelApi(params);
      return data;
    },
  },
});

export function useUserStoreWithOut() {
  return adminStore(store);
}
